\(\int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx\) [172]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 19, antiderivative size = 69 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {a \cot (c+d x)}{d}-\frac {a \cot ^3(c+d x)}{3 d}-\frac {b \csc (c+d x)}{d}-\frac {b \csc ^3(c+d x)}{3 d} \]

[Out]

b*arctanh(sin(d*x+c))/d-a*cot(d*x+c)/d-1/3*a*cot(d*x+c)^3/d-b*csc(d*x+c)/d-1/3*b*csc(d*x+c)^3/d

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.316, Rules used = {3957, 2917, 2701, 308, 213, 3852} \[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=-\frac {a \cot ^3(c+d x)}{3 d}-\frac {a \cot (c+d x)}{d}+\frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {b \csc ^3(c+d x)}{3 d}-\frac {b \csc (c+d x)}{d} \]

[In]

Int[Csc[c + d*x]^4*(a + b*Sec[c + d*x]),x]

[Out]

(b*ArcTanh[Sin[c + d*x]])/d - (a*Cot[c + d*x])/d - (a*Cot[c + d*x]^3)/(3*d) - (b*Csc[c + d*x])/d - (b*Csc[c +
d*x]^3)/(3*d)

Rule 213

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(-(Rt[-a, 2]*Rt[b, 2])^(-1))*ArcTanh[Rt[b, 2]*(x/Rt[-a, 2])]
, x] /; FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rule 308

Int[(x_)^(m_)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Int[PolynomialDivide[x^m, a + b*x^n, x], x] /; FreeQ[{a,
b}, x] && IGtQ[m, 0] && IGtQ[n, 0] && GtQ[m, 2*n - 1]

Rule 2701

Int[(csc[(e_.) + (f_.)*(x_)]*(a_.))^(m_)*sec[(e_.) + (f_.)*(x_)]^(n_.), x_Symbol] :> Dist[-(f*a^n)^(-1), Subst
[Int[x^(m + n - 1)/(-1 + x^2/a^2)^((n + 1)/2), x], x, a*Csc[e + f*x]], x] /; FreeQ[{a, e, f, m}, x] && Integer
Q[(n + 1)/2] &&  !(IntegerQ[(m + 1)/2] && LtQ[0, m, n])

Rule 2917

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)
*(x_)]), x_Symbol] :> Dist[a, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Dist[b/d, Int[(g*Cos[e + f*x
])^p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3957

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_.), x_Symbol] :> Int[(g*Co
s[e + f*x])^p*((b + a*Sin[e + f*x])^m/Sin[e + f*x]^m), x] /; FreeQ[{a, b, e, f, g, p}, x] && IntegerQ[m]

Rubi steps \begin{align*} \text {integral}& = -\int (-b-a \cos (c+d x)) \csc ^4(c+d x) \sec (c+d x) \, dx \\ & = a \int \csc ^4(c+d x) \, dx+b \int \csc ^4(c+d x) \sec (c+d x) \, dx \\ & = -\frac {a \text {Subst}\left (\int \left (1+x^2\right ) \, dx,x,\cot (c+d x)\right )}{d}-\frac {b \text {Subst}\left (\int \frac {x^4}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = -\frac {a \cot (c+d x)}{d}-\frac {a \cot ^3(c+d x)}{3 d}-\frac {b \text {Subst}\left (\int \left (1+x^2+\frac {1}{-1+x^2}\right ) \, dx,x,\csc (c+d x)\right )}{d} \\ & = -\frac {a \cot (c+d x)}{d}-\frac {a \cot ^3(c+d x)}{3 d}-\frac {b \csc (c+d x)}{d}-\frac {b \csc ^3(c+d x)}{3 d}-\frac {b \text {Subst}\left (\int \frac {1}{-1+x^2} \, dx,x,\csc (c+d x)\right )}{d} \\ & = \frac {b \text {arctanh}(\sin (c+d x))}{d}-\frac {a \cot (c+d x)}{d}-\frac {a \cot ^3(c+d x)}{3 d}-\frac {b \csc (c+d x)}{d}-\frac {b \csc ^3(c+d x)}{3 d} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.04 (sec) , antiderivative size = 69, normalized size of antiderivative = 1.00 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=-\frac {2 a \cot (c+d x)}{3 d}-\frac {a \cot (c+d x) \csc ^2(c+d x)}{3 d}-\frac {b \csc ^3(c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {3}{2},1,-\frac {1}{2},\sin ^2(c+d x)\right )}{3 d} \]

[In]

Integrate[Csc[c + d*x]^4*(a + b*Sec[c + d*x]),x]

[Out]

(-2*a*Cot[c + d*x])/(3*d) - (a*Cot[c + d*x]*Csc[c + d*x]^2)/(3*d) - (b*Csc[c + d*x]^3*Hypergeometric2F1[-3/2,
1, -1/2, Sin[c + d*x]^2])/(3*d)

Maple [A] (verified)

Time = 0.97 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.91

method result size
derivativedivides \(\frac {a \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )+b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}\) \(63\)
default \(\frac {a \left (-\frac {2}{3}-\frac {\csc \left (d x +c \right )^{2}}{3}\right ) \cot \left (d x +c \right )+b \left (-\frac {1}{3 \sin \left (d x +c \right )^{3}}-\frac {1}{\sin \left (d x +c \right )}+\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )\right )}{d}\) \(63\)
parallelrisch \(\frac {-24 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )+24 b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )+\left (-a -b \right ) \cot \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}+\left (-9 a -15 b \right ) \cot \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (a -b \right )+9 a -15 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{24 d}\) \(107\)
risch \(-\frac {2 i \left (3 b \,{\mathrm e}^{5 i \left (d x +c \right )}-10 b \,{\mathrm e}^{3 i \left (d x +c \right )}-6 a \,{\mathrm e}^{2 i \left (d x +c \right )}+3 b \,{\mathrm e}^{i \left (d x +c \right )}+2 a \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}+\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right )}{d}-\frac {b \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right )}{d}\) \(110\)
norman \(\frac {-\frac {a +b}{24 d}+\frac {\left (a -b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}}{24 d}+\frac {\left (3 a -5 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{8 d}-\frac {\left (3 a +5 b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}}{8 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{3}}+\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {b \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(125\)

[In]

int(csc(d*x+c)^4*(a+b*sec(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*(-2/3-1/3*csc(d*x+c)^2)*cot(d*x+c)+b*(-1/3/sin(d*x+c)^3-1/sin(d*x+c)+ln(sec(d*x+c)+tan(d*x+c))))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.81 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=-\frac {4 \, a \cos \left (d x + c\right )^{3} + 6 \, b \cos \left (d x + c\right )^{2} - 3 \, {\left (b \cos \left (d x + c\right )^{2} - b\right )} \log \left (\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) + 3 \, {\left (b \cos \left (d x + c\right )^{2} - b\right )} \log \left (-\sin \left (d x + c\right ) + 1\right ) \sin \left (d x + c\right ) - 6 \, a \cos \left (d x + c\right ) - 8 \, b}{6 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )} \sin \left (d x + c\right )} \]

[In]

integrate(csc(d*x+c)^4*(a+b*sec(d*x+c)),x, algorithm="fricas")

[Out]

-1/6*(4*a*cos(d*x + c)^3 + 6*b*cos(d*x + c)^2 - 3*(b*cos(d*x + c)^2 - b)*log(sin(d*x + c) + 1)*sin(d*x + c) +
3*(b*cos(d*x + c)^2 - b)*log(-sin(d*x + c) + 1)*sin(d*x + c) - 6*a*cos(d*x + c) - 8*b)/((d*cos(d*x + c)^2 - d)
*sin(d*x + c))

Sympy [F]

\[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=\int \left (a + b \sec {\left (c + d x \right )}\right ) \csc ^{4}{\left (c + d x \right )}\, dx \]

[In]

integrate(csc(d*x+c)**4*(a+b*sec(d*x+c)),x)

[Out]

Integral((a + b*sec(c + d*x))*csc(c + d*x)**4, x)

Maxima [A] (verification not implemented)

none

Time = 0.21 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.10 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=-\frac {b {\left (\frac {2 \, {\left (3 \, \sin \left (d x + c\right )^{2} + 1\right )}}{\sin \left (d x + c\right )^{3}} - 3 \, \log \left (\sin \left (d x + c\right ) + 1\right ) + 3 \, \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + \frac {2 \, {\left (3 \, \tan \left (d x + c\right )^{2} + 1\right )} a}{\tan \left (d x + c\right )^{3}}}{6 \, d} \]

[In]

integrate(csc(d*x+c)^4*(a+b*sec(d*x+c)),x, algorithm="maxima")

[Out]

-1/6*(b*(2*(3*sin(d*x + c)^2 + 1)/sin(d*x + c)^3 - 3*log(sin(d*x + c) + 1) + 3*log(sin(d*x + c) - 1)) + 2*(3*t
an(d*x + c)^2 + 1)*a/tan(d*x + c)^3)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 133 vs. \(2 (65) = 130\).

Time = 0.31 (sec) , antiderivative size = 133, normalized size of antiderivative = 1.93 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 24 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 24 \, b \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) + 9 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 15 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - \frac {9 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 15 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a + b}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

[In]

integrate(csc(d*x+c)^4*(a+b*sec(d*x+c)),x, algorithm="giac")

[Out]

1/24*(a*tan(1/2*d*x + 1/2*c)^3 - b*tan(1/2*d*x + 1/2*c)^3 + 24*b*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - 24*b*log
(abs(tan(1/2*d*x + 1/2*c) - 1)) + 9*a*tan(1/2*d*x + 1/2*c) - 15*b*tan(1/2*d*x + 1/2*c) - (9*a*tan(1/2*d*x + 1/
2*c)^2 + 15*b*tan(1/2*d*x + 1/2*c)^2 + a + b)/tan(1/2*d*x + 1/2*c)^3)/d

Mupad [B] (verification not implemented)

Time = 14.85 (sec) , antiderivative size = 101, normalized size of antiderivative = 1.46 \[ \int \csc ^4(c+d x) (a+b \sec (c+d x)) \, dx=\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (\frac {a}{24}-\frac {b}{24}\right )}{d}-\frac {{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3\,\left (\left (3\,a+5\,b\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+\frac {a}{3}+\frac {b}{3}\right )}{8\,d}+\frac {2\,b\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}{d}+\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (\frac {3\,a}{8}-\frac {5\,b}{8}\right )}{d} \]

[In]

int((a + b/cos(c + d*x))/sin(c + d*x)^4,x)

[Out]

(tan(c/2 + (d*x)/2)^3*(a/24 - b/24))/d - (cot(c/2 + (d*x)/2)^3*(a/3 + b/3 + tan(c/2 + (d*x)/2)^2*(3*a + 5*b)))
/(8*d) + (2*b*atanh(tan(c/2 + (d*x)/2)))/d + (tan(c/2 + (d*x)/2)*((3*a)/8 - (5*b)/8))/d